package com.zmn.plat.common.dictionary;

/**
 * 描述: 渠道服务商三级类型
 *
 * @author jiafei
 * @version v1.0
 * @since 2021/6/9 18:40
 */
public enum ChannelSpThirdTypeEnum {
    /**
     * 描述: 服务商
     */
    SERVICE_PROVIDER(10, "服务商"),
    /**
     * 描述: 承包商
     */
    CONTRACTOR(10, "承包商"),
    /**
     * 描述: 合伙人
     */
    PARTNER(10, "合伙人"),
    ;

    private Integer code;
    private String name;

    ChannelSpThirdTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 描述:
     *
     * @param code code
     * @return com.zmn.plat.common.dictionary.ChannelSpTwoTypeEnum
     * @author jiafei
     * @since 2021/6/9 18:37
     */
    public static ChannelSpThirdTypeEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 10:
                return SERVICE_PROVIDER;
            case 20:
                return CONTRACTOR;
            case 30:
                return PARTNER;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelSpThirdTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
